
// Copyright (C) 2015  Frode Roxrud Gill
// See LICENSE file for license

#include "font.h"

#include "xmega/utils/progmem.h"


static PROGMEM_DECLARE(U8, g_6pxFont6_alphabet_p[]) = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz{}";

static PROGMEM_DECLARE(U8, g_6pxFont6_font_p[]) = {
CHAR_SIZE(3,0,0), //[SPACE]

CHAR_SIZE(1,5,0), //!
0b10000000,
0b10000000,
0b10000000,
0b00000000,
0b10000000,

CHAR_SIZE(3,2,0), //"
0b10100000,
0b10100000,

CHAR_SIZE(5,5,0), //#
0b0101000,
0b1111100,
0b0101000,
0b1111100,
0b0101000,

CHAR_SIZE(3,6,0), //$
0b01000000,
0b01100000,
0b10000000,
0b00100000,
0b11000000,
0b01000000,

CHAR_SIZE(4,4,1), //%
0b10010000,
0b00100000,
0b01000000,
0b10010000,

CHAR_SIZE(4,5,0), //&
0b01000000,
0b10100000,
0b01000000,
0b10100000,
0b11010000,

CHAR_SIZE(1,2,0), //'
0b10000000,
0b10000000,

CHAR_SIZE(2,5,0), //(
0b01000000,
0b10000000,
0b10000000,
0b10000000,
0b01000000,

CHAR_SIZE(2,5,0), //)
0b10000000,
0b01000000,
0b01000000,
0b01000000,
0b10000000,

CHAR_SIZE(3,3,0), //*
0b10100000,
0b01000000,
0b10100000,

CHAR_SIZE(3,3,1), //+
0b01000000,
0b11100000,
0b01000000,

CHAR_SIZE(1,2,4), //,
0b10000000,
0b10000000,

CHAR_SIZE(2,1,2), //-
0b11000000,

CHAR_SIZE(1,1,4), //.
0b10000000,

CHAR_SIZE(3,5,0), // /
0b00100000,
0b00100000,
0b01000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,5,0), //0
0b01000000,
0b10100000,
0b11100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,0), //1
0b01000000,
0b11000000,
0b01000000,
0b01000000,
0b11100000,

CHAR_SIZE(3,5,0), //2
0b01000000,
0b10100000,
0b00100000,
0b10000000,
0b11100000,

CHAR_SIZE(3,5,0), //3
0b11000000,
0b00100000,
0b01000000,
0b00100000,
0b11000000,

CHAR_SIZE(3,5,0), //4
0b00100000,
0b10100000,
0b10100000,
0b11100000,
0b00100000,

CHAR_SIZE(3,5,0), //5
0b11100000,
0b10000000,
0b11000000,
0b00100000,
0b11000000,

CHAR_SIZE(3,5,0), //6
0b01100000,
0b10000000,
0b11000000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,0), //7
0b11100000,
0b00100000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,5,0), //8
0b01000000,
0b10100000,
0b01000000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,0), //9
0b01000000,
0b10100000,
0b01100000,
0b00100000,
0b11000000,

CHAR_SIZE(1,3,2), //:
0b10000000,
0b00000000,
0b10000000,

CHAR_SIZE(1,4,2), //;
0b10000000,
0b00000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,5,0), //<
0b00100000,
0b01000000,
0b10000000,
0b01000000,
0b00100000,

CHAR_SIZE(3,3,1), //=
0b11100000,
0b00000000,
0b11100000,

CHAR_SIZE(3,5,0), //>
0b10000000,
0b01000000,
0b00100000,
0b01000000,
0b10000000,

CHAR_SIZE(3,5,0), //?
0b11000000,
0b00100000,
0b01000000,
0b00000000,
0b01000000,

CHAR_SIZE(4,5,0), //@
0b01100000,
0b10010000,
0b10110000,
0b10000000,
0b01110000,

CHAR_SIZE(3,5,0), //A
0b01000000,
0b10100000,
0b10100000,
0b11100000,
0b10100000,

CHAR_SIZE(3,5,0), //B
0b11000000,
0b10100000,
0b11000000,
0b10100000,
0b11000000,

CHAR_SIZE(3,5,0), //C
0b01000000,
0b10100000,
0b10000000,
0b10000000,
0b01100000,

CHAR_SIZE(3,5,0), //D
0b11000000,
0b10100000,
0b10100000,
0b10100000,
0b11000000,

CHAR_SIZE(3,5,0), //E
0b01100000,
0b10000000,
0b11000000,
0b10000000,
0b01100000,

CHAR_SIZE(3,5,0), //F
0b01100000,
0b10000000,
0b11000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,5,0), //G
0b01100000,
0b10000000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,5,0), //H
0b10100000,
0b10100000,
0b11100000,
0b10100000,
0b10100000,

CHAR_SIZE(1,5,0), //I
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,5,0), //J
0b00100000,
0b00100000,
0b00100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,0), //K
0b10100000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,

CHAR_SIZE(2,5,0), //L
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b11000000,

CHAR_SIZE(5,5,0), //M
0b01010000,
0b10101000,
0b10101000,
0b10101000,
0b10101000,

CHAR_SIZE(4,5,0), //N
0b10010000,
0b11010000,
0b10110000,
0b10010000,
0b10010000,

CHAR_SIZE(3,5,0), //O
0b01000000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,0), //P
0b11000000,
0b10100000,
0b10100000,
0b11000000,
0b10000000,

CHAR_SIZE(3,5,0), //Q
0b01000000,
0b10100000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,5,0), //R
0b11000000,
0b10100000,
0b10100000,
0b11000000,
0b10100000,

CHAR_SIZE(3,5,0), //S
0b01100000,
0b10000000,
0b01000000,
0b00100000,
0b11000000,

CHAR_SIZE(3,5,0), //T
0b11100000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,5,0), //U
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,5,0), //V
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(5,5,0), //W
0b10101000,
0b10101000,
0b10101000,
0b10101000,
0b01010000,

CHAR_SIZE(3,5,0), //X
0b10100000,
0b10100000,
0b01000000,
0b10100000,
0b10100000,

CHAR_SIZE(3,5,0), //Y
0b10100000,
0b10100000,
0b10100000,
0b01000000,
0b01000000,

CHAR_SIZE(3,5,0), //Z
0b11100000,
0b00100000,
0b01000000,
0b10000000,
0b11100000,

CHAR_SIZE(2,5,0), //[
0b11000000,
0b10000000,
0b10000000,
0b10000000,
0b11000000,

CHAR_SIZE(2,5,0), //]
0b11000000,
0b01000000,
0b01000000,
0b01000000,
0b11000000,

CHAR_SIZE(3,1,4), //_
0b11100000,

CHAR_SIZE(3,4,1), //a
0b01000000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,5,0), //b
0b10000000,
0b11000000,
0b10100000,
0b10100000,
0b11000000,

CHAR_SIZE(3,4,1), //c
0b01000000,
0b10100000,
0b10000000,
0b01100000,

CHAR_SIZE(3,5,0), //d
0b00100000,
0b01100000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,4,1), //e
0b01000000,
0b10100000,
0b11000000,
0b01100000,

CHAR_SIZE(3,5,0), //f
0b00100000,
0b01000000,
0b11100000,
0b01000000,
0b01000000,

CHAR_SIZE(3,5,1), //g
0b01100000,
0b10100000,
0b10100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,5,0), //h
0b10000000,
0b11000000,
0b10100000,
0b10100000,
0b10100000,

CHAR_SIZE(1,5,0), //i
0b10000000,
0b00000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(2,6,0), //j
0b01000000,
0b00000000,
0b01000000,
0b01000000,
0b01000000,
0b10000000,

CHAR_SIZE(3,5,0), //k
0b10000000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,

CHAR_SIZE(2,5,0), //l
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b01000000,

CHAR_SIZE(5,4,1), //m
0b11010000,
0b10101000,
0b10101000,
0b10101000,

CHAR_SIZE(3,4,1), //n
0b11000000,
0b10100000,
0b10100000,
0b10100000,

CHAR_SIZE(3,4,1), //o
0b01000000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,5,1), //p
0b01000000,
0b10100000,
0b10100000,
0b11000000,
0b10000000,

CHAR_SIZE(3,5,1), //q
0b01000000,
0b10100000,
0b10100000,
0b01100000,
0b00100000,

CHAR_SIZE(3,4,1), //r
0b01000000,
0b10100000,
0b10000000,
0b10000000,

CHAR_SIZE(3,4,1), //s
0b01100000,
0b10000000,
0b00100000,
0b11000000,

CHAR_SIZE(2,5,0), //t
0b10000000,
0b11000000,
0b10000000,
0b10000000,
0b01000000,

CHAR_SIZE(3,4,1), //u
0b10100000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,4,1), //v
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(5,4,1), //w
0b10101000,
0b10101000,
0b10101000,
0b01010000,

CHAR_SIZE(3,4,1), //x
0b10100000,
0b01000000,
0b01000000,
0b10100000,

CHAR_SIZE(3,5,1), //y
0b10100000,
0b10100000,
0b10100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,4,1), //z
0b11100000,
0b00100000,
0b10000000,
0b11100000,

CHAR_SIZE(3,5,0), //{
0b01100000,
0b01000000,
0b10000000,
0b01000000,
0b01100000,

CHAR_SIZE(3,5,0), //}
0b11000000,
0b01000000,
0b00100000,
0b01000000,
0b11000000
};

_6pxFont6::_6pxFont6()
: Font(6, 1, &g_6pxFont6_alphabet_p[0], &g_6pxFont6_font_p[0])
{
}

_6pxFont6::~_6pxFont6()
{
}

U8 _6pxFont6::GetAlphabetByte(U8 pos) const
{
	return pgm_read_byte(&g_6pxFont6_font_p[pos]);
}

U8 _6pxFont6::GetFontdataByte(U16 ch_offset, U8 pos) const
{
	return pgm_read_byte(&g_6pxFont6_font_p[ch_offset+pos]);
}
